﻿/* Flash调用控件 */
function flashShow(url,width,height,var1) {
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0" width="'+width+'" height="'+height+'">');
    document.write('<param name="movie" value="'+url+'" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="flashVars" value="'+var1+'" />');
    document.write('<param name="wmode" value="transparent" />');
    document.write('<param name="menu" value="false" />');
    document.write('<embed flashvars="'+var1+'" src="'+url+'" wmode="transparent" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
    document.write('</object>');
}

//anti_spam 防范垃圾邮件 anti_spam("domain","liam");
function anti_spam(domain,in_email) {
  var out_email = "", i;

  for (i = 0; i < in_email.length; i++) {
    out_email += in_email.charAt(in_email.length - i - 1);
  };
  document.write("<a href=\"mailto:" + out_email +"@"+ domain + "\">" + out_email +"@"+ domain + "</a>");
}
function anti_mail(domain,in_email) {
  document.write("<a href=\"mailto:" + in_email +"@"+ domain + "\">" + in_email +"@"+ domain + "</a>");
}

/* jquery下拉菜单*/
/* ///cedar 2013-08-29 /// */
$(document).ready(function(){
  $('li.mainlevel').hover(function(){
	$(this).find('ul').stop(true,true);
	$(this).find('ul').slideDown("fast");
  },
  function(){
  	if($(this).find('ul').css("display") != "none")
  		$(this).find('ul').slideUp("fast");
  });
});

/* 侧边咨询栏 */
var floatAtBottom = false;
//var slideTime = 700;
var slideTime = 10;
function jMarquee() {
    $('#divMarquee').marquee({
        speed: 30000,     
        gap:50,           
        pauseOnHover: true
    }).css("height", "30px");
}
//function floater_init() {
//    winOnResize(); // set initial position
//    xAddEventListener(window, 'resize', winOnResize, false);
//    xAddEventListener(window, 'scroll', winOnScroll, false);
//    var x = $(window).width() - $("#imgLC").width();
//    $("#scoLfw").css("left", x + "px");
//}
function winOnResize() {
    winOnScroll(); // initial slide
    var x = $(window).width() - $("#imgLC").width();
    $("#scoLfw").css("left", x + "px");
}
function winOnScroll() {
    var y = xScrollTop() + ($(window).height() / 2 - $("#imgLC").height() / 2);
    x = $(window).width() - $("#imgLC").width();
    if (floatAtBottom) {
        y += xClientHeight() - xHeight('scoLfw');
    }
    xSlideTo('scoLfw', x, y, slideTime);
    xSlideTo('divPromoBanner', 0, y - 40, slideTime);
}
function hideLC(i) {
    if (i === undefined) {
        var ic = getCookie("showLC");
        if (ic !== undefined) {
            if (ic === "0")
                $("#scoLfw").css("display", "none");
        }
    } else {
        $("#scoLfw").css("display", "none");
        setCookie("showLC", "0", 1);
    }
}
function hidePromo(i) {
    if (i === undefined) {
        var ic = getCookie("showPM");
        if (ic !== undefined) {
            if (ic === "0")
                $("#divPromoBanner").css("display", "none");
        }
    } else {
        $("#divPromoBanner").css("display", "none");
        setCookie("showPM", "0", 1);
    }
}

function setCookie(){
   var never = new Date();
   //设置never的时间为当前时间加上十年的毫秒值
   never.setTime(never.getTime()+10*365*24*60*60*1000);    
   var expString = "expires="+ never.toGMTString()+";";
     
   document.cookie = "area="+escape("北京海淀")+"; "+expString;
   document.cookie = "zipcode=100080;";
     
}// end function
  
  
function getCookie(name){
   var result = null;
   //对cookie信息进行相应的处理，方便搜索
   var myCookie = ""+document.cookie+";"; 
   var searchName = name+"=";
   var startOfCookie = myCookie.indexOf(searchName);
   var endOfCookie;
   if(startOfCookie != -1){
       startOfcookie += searchName.length;
       endOfCookie = myCookie.indexOf(";",startOfCookie);
       result = (myCookie.substring(startOfCookie,endOfCookie));
   }
   return result;
} //end function